package com.wxy.test1.problem2;

public class CanadianPostalCode {
    private boolean digitFlag = true;
    private boolean characterFlag = true;

    public CanadianPostalCode() {
    }

    public boolean isValidCanadianPcode(String var1, String var2) {
        char[] var3 = this.toNonBlankCharArray(var1);
        if (var3.length != 6) {
            return false;
        } else {
            for(int var4 = 0; var4 < var3.length / 2; ++var4) {
                if (!Character.isLetter(var3[2 * var4])) {
                    this.characterFlag = false;
                }

                if (!Character.isDigit(var3[2 * var4 + 1])) {
                    this.digitFlag = false;
                }
            }

            if (this.digitFlag && this.characterFlag) {
                return true;
            } else {
                return false;
            }
        }
    }

    public char[] toNonBlankCharArray(String var1) {
        int var2 = 0;

        for(int var3 = 0; var3 < var1.length(); ++var3) {
            if (!Character.isSpaceChar(var1.charAt(var3))) {
                ++var2;
            }
        }

        char[] var6 = new char[var2];
        int var4 = 0;

        for(int var5 = 0; var5 < var1.length(); ++var5) {
            if (!Character.isSpaceChar(var1.charAt(var5))) {
                var6[var4] = var1.charAt(var5);
                ++var4;
            }
        }

        return var6;
    }
}
